package com.chinatsp.onlineapp.utils;

import tsp.cn.http.tools.LogUtil;
import android.graphics.drawable.AnimationDrawable;
import android.util.Log;
import android.widget.ImageView;

import com.chinatsp.onlineapp.R;
import com.chinatsp.onlineapp.base.Config;

/**
 * 根据返回的weather_type，显示对应的状态
 */

public class WeatherType {

	/**
	 * 根据weather_type, 显示状态图片
	 */
	public static void showImg(String type, ImageView ivWeatherType) {

		 if (type.length() > 2) {
			String[] types = new String[2];
			types[0] = type.substring(0, 2);
			types[1] = type.substring(2, 4);
			type = types[0];
		}

		else if (Config.WEATHER_SUNNY.equals(type)) { // 晴天
			ivWeatherType.setBackgroundResource(R.drawable.weather_sunny);
		}
		else if (Config.WEATHER_CLOUDY.equals(type)) { // 多云
			ivWeatherType.setBackgroundResource(R.drawable.weather_cloudy);
		}
		else if (Config.WEATHER_OVERCAST.equals(type)) { // 阴
			ivWeatherType.setBackgroundResource(R.drawable.weather_overcast);
		}
		else if (Config.WEATHER_FOG.equals(type)) { // 阴
			ivWeatherType.setBackgroundResource(R.drawable.weather_fog);
		}

		else if (Config.WEATHER_LIGHT_RAIN.equals(type)) { // 小雨
			ivWeatherType.setBackgroundResource(R.drawable.weather_light_rain);
		}
		else if (Config.WEATHER_MODETATE_RAIN.equals(type)) { // 中雨
			ivWeatherType.setBackgroundResource(R.drawable.weather_moderate_rain);
		}
		else if (Config.WEATHER_HARD_RAIN.equals(type)) { // 大雨
			ivWeatherType.setBackgroundResource(R.drawable.weather_hard_rain);
		}
		else if (Config.WEATHER_HEAVY_RAIN.equals(type)) { // 暴雨
			ivWeatherType.setBackgroundResource(R.drawable.weather_heavy_rain);
		}
		else if (Config.WEATHER_LIGHT_SNOW.equals(type)) { // 小雪
			ivWeatherType.setBackgroundResource(R.drawable.weather_light_snow);
		}
		else if (Config.WEATHER_MODERATE_SNOW.equals(type)) { // 中雪
			ivWeatherType.setBackgroundResource(R.drawable.weather_moderate_snow);
		}
		else if (Config.WEATHER_HARD_SNOW.equals(type)) { // 大雪
			ivWeatherType.setBackgroundResource(R.drawable.weather_hard_snow);
		}
		else if (Config.WEATHER_HEAVY_SNOW.equals(type)) { // 暴雪
			ivWeatherType.setBackgroundResource(R.drawable.weather_heavy_snow);
			
		}
		else if (Config.WEATHER_FOG.equals(type)) { // 雾
			ivWeatherType.setBackgroundResource(R.drawable.weather_fog);
			
		}
		else if (Config.WEATHER_SAND_STORM.equals(type)) { // 沙尘暴
			ivWeatherType.setBackgroundResource(R.drawable.weather_sand_storm);
			
		}
		else if (Config.WEATHER_RAISE_DUST.equals(type)) { // 扬沙
			ivWeatherType.setBackgroundResource(R.drawable.weather_raise_dust);
			
		}
		
//		 else{
//		 ivWeatherType.setBackgroundResource(R.drawable.noinformatiaon_icon);
//		 }



	}
}
